package com.da.javatest.leetCode;

import java.util.Arrays;

/**
 * @author chenlida
 * @date 2019/1/7 11:19
 * @description
 */
public class Code136 {
    public int singleNumber(int[] nums) {
        //Arrays.sort(nums);
        //for (int i = 0; i < nums.length - 2; i += 2) {
        //    if (nums[i] != nums[i + 1]) {return nums[i];}
        //}
        //return nums[nums.length - 1];

        int result = 0;
        for (int num : nums) {
            result ^= num;
        }
        return result;
    }
}
